<?php 

// +---------------------------------------------+
// |     Copyright  2010 - 2018 InterPhoto       |
// |     http://www.weentech.com                 |
// |     This file may not be redistributed.     |
// +---------------------------------------------+


include('includes/InterPhoto.Core.php');
include(BASEPATH.'library/exif/exif.php');

$getfiles = explode('/', base64_decode(ForceIncomingString('file')));

if(!$getfiles OR sizeof($getfiles) < 2){
	die('File not found!');
}

$filepath0 = ForceDir($getfiles[0]);
$filepath1 = ForceDir($getfiles[1]);
$image_path = BASEPATH.'MyWebsiteImages/'.$filepath0.'_'.WEBSITE_KEY.'/original/'.$filepath1;

if (!file_exists($image_path)) {
	$image_path = BASEPATH.'MyWebsiteImages/'.$filepath0.'_'.WEBSITE_KEY.'/760x760/'.$filepath1;
	if (!file_exists($image_path)) {exit();}
}


$exif = read_exif_data_raw($image_path,0);	


?>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title><?php echo $langs['viewexif'];?></title>
<style type="text/css">
body {
	background: #ffffff;
	margin: 10px;
	padding-bottom: 10px;
}
body, div {
	font-family: "Trebuchet MS", tahoma, arial, verdana;
	font-size: 12px;
	color: #000;
	line-height: 160%;
}

table {border-collapse:collapse;}
table td {height:26px;border:1px solid #D2D2D2;padding-left:8px;}

</style>
</head>
<body>




<?php
if($exif['ValidEXIFData']){

echo '<table border="0" cellpadding="0" cellspacing="0" width="100%"><tr>
<td colspan="2" align="center" valign="middle" style="height:90px;"><img src="InterPhoto.thumbnail.php?file='.InterEncode($filepath0.'/1/'.$filepath1).'"  border="0"></td>
</tr>
<tr>
<td>'.$langs['maker'].': </td><td>'. trim($exif['IFD0']['Make']).'</td>
</tr>

<tr>
<td>'. $langs['model'].': </td><td>'. trim($exif['IFD0']['Model']).'</td>
</tr>
<tr>
<td>'. $langs['shutterspeed'].': </td><td>'. trim($exif['SubIFD']['ExposureTime']).'</td>
</tr>
<tr>
<td>'. $langs['aperture'].': </td><td>'. trim($exif['SubIFD']['FNumber']).'</td>
</tr>
<tr>
<td>'. $langs['iso'].': </td><td>'. trim($exif['SubIFD']['ISOSpeedRatings']).'</td>
</tr>
<tr>
<td>'. $langs['quality'].': </td><td>'. trim($exif['SubIFD']['MakerNote']['Quality']).'</td>
</tr>
<tr>
<td>'. $langs['exposuremode'].': </td><td>'. Iif(trim($exif['SubIFD']['ExposureMode']), 'Manual', 'Auto').'</td>
</tr>
<tr>
<td>'. $langs['shootingmode'].': </td><td>'. trim($exif['SubIFD']['MakerNote']['FocusMode']).'</td>
</tr>
<tr>
<td>'. $langs['whitebalance'].': </td><td>'. trim($exif['SubIFD']['MakerNote']['WhiteBalance']).'</td>
</tr>
<tr>
<td>'. $langs['meteringmode'].': </td><td>'. trim($exif['SubIFD']['MeteringMode']).'</td>
</tr>
<tr>
<td>'. $langs['flashmode'].': </td><td>'. trim($exif['SubIFD']['Flash']).'</td>
</tr>
<tr>
<td>'. $langs['focallength'].': </td><td>'. trim($exif['SubIFD']['FocalLength']).'</td>
</tr>
<tr>
<td>'. $langs['imagewidth'].': </td><td>'. trim($exif['SubIFD']['ExifImageWidth']).'</td>
</tr>
<tr>
<td>'. $langs['imageheight'].': </td><td>'. trim($exif['SubIFD']['ExifImageHeight']).'</td>
</tr>
<tr>
<td>'. $langs['originaltaken'].': </td><td>'. trim($exif['SubIFD']['DateTimeOriginal']).'</td>
</tr></table>';


}else{
	echo '<div style="margin-top:80px;text-align:center;color:#FF0000;">'. $langs['noexifinfo'].'</div>';
}

?>


</body>
</html>